package com.ag.zrt.action;

import javax.annotation.Resource;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.ag.common.BaseAction;
import com.ag.zrt.service.InformationService;
@Controller("deleteInformationAction")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class DeleteInformationAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4037971301054202654L;
	@Resource(name = "InformationService")
	private InformationService informationService;
	private String id;
	private String msg;
	private String errorDetail;

	public String getMsg() {
		return msg;
	}

	public String getErrorDetail() {
		return errorDetail;
	}

	public void setInformationService(InformationService informationService) {
		this.informationService = informationService;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Override
	public String execute() throws Exception{
		// TODO Auto-generated method stub
		try {
			informationService.delete(id);
			msg = "删除成功";
			errorDetail = "";
			return "delete_info_succ";
		} catch (Exception e) {
			msg = "删除失败";
			errorDetail = e.toString();
			return "delete_info_failed";
		}
		
	}

}
